Date

Crystal syntax.

The CDate and DateValue functions are equivalent to Date. However, Date can only be used in Crystal syntax since it is a type name in Basic syntax.

Overloads
Arguments

Date (number)

  • number is a value representing the number of days starting from December 30, 1899.
  • It can be positive or negative, and is truncated if fractional.

Date (string)

  • string is a text string representing a date, example: "September 20, 1999".

Date (dateTime)

  • dateTime is a DateTime value.

Date (YYYY, MM, DD)

  • YYYY is a whole number representing a year, example: 1996.
  • MM is a whole number representing a month, example: 12 for December.
  • DD is a whole number representing a day of the month, example: 05.

Returns

A Date value.

Action

Date (number)

Returns a Date value given a number of days starting from December 30, 1899.

Date (string)

Returns a Date value given a string that represents a date from January 1, 100 through December 31, 9999.

Date (dateTime)

Returns the date portion of a given DateTime value.

Date (YYYY, MM, DD)

Returns a Date value given numeric arguments of the year, month, and day.

Examples

The following examples are applicable to Crystal syntax:

Date ("Dec 31, 1999")

Returns the Date value for Dec. 31, 1999.

Date (50)

Returns the Date value for February 18, 1900.

Date (#Oct. 20, 1999 12:02pm#)

Returns the Date value for October 20, 1999.

Date (1930, 7, 30)

Returns the Date value for July 30, 1930.

Comments

You can use the IsDate function to check if a String argument can be converted to a Date before doing the actual conversion. That way, if the conversion cannot be done, you can handle the situation appropriately.

Related topics

DateSerial (year, month, day)



Seagate Software, Inc.
http://www.seagatesoftware.com
Please send comments to:
techpubs@seagatesoftware.com